//
//  XFNewFeatureViewController.m
//  SinaBlog_OC
//
//  Created by macs on 15/11/13.
//  Copyright © 2015年 BlackTail. All rights reserved.
//

#import "XFNewFeatureViewController.h"
#import "XFNewFeatureCell.h"

@interface XFNewFeatureViewController ()

@end

@implementation XFNewFeatureViewController

static NSString *const reuseIdentifier = @"Cell";

- (instancetype)init {

  UICollectionViewFlowLayout *layout =
      [[UICollectionViewFlowLayout alloc] init];
  layout.itemSize = [UIScreen mainScreen].bounds.size;
  layout.minimumLineSpacing = 0;
  layout.minimumInteritemSpacing = 0;
  layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  return [super initWithCollectionViewLayout:layout];
}

- (void)viewDidLoad {
  [super viewDidLoad];

  [self.collectionView registerClass:[XFNewFeatureCell class]
          forCellWithReuseIdentifier:reuseIdentifier];

  self.collectionView.pagingEnabled = YES;
  self.collectionView.showsHorizontalScrollIndicator = NO;
  self.collectionView.bounces = NO;
}

- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}


#pragma mark <UICollectionViewDataSource>

- (NSInteger)collectionView:(UICollectionView *)collectionView
     numberOfItemsInSection:(NSInteger)section {

  return kImageCount;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
                  cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  XFNewFeatureCell *cell =
      [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier
                                                forIndexPath:indexPath];

  cell.index = indexPath.item;
  return cell;
}

@end
